package com.tencent.qf.team.controller;

import com.alibaba.fastjson.JSON;
import com.tencent.qf.common.pojo.HttpResult;
import com.tencent.qf.team.dto.request.UserOrderCpsStatisticRequest;
import com.tencent.qf.team.dto.response.UserOrderCpsStatisticResponse;
import com.tencent.qf.team.service.UserOrderCpsService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
public class UserOrderCpsStatisticController {


    @Autowired
    private UserOrderCpsService userOrderCpsService;

    @PostMapping("/api/team/userOrderCpsStatistic")
    @ApiOperation("用户个人(不包含下属)维度累计聚合")
    public HttpResult<List<UserOrderCpsStatisticResponse>> userOrderCpsStatistic(@RequestBody UserOrderCpsStatisticRequest request) {
        log.info("用户个人(不包含下属)维度累计聚合，入参：{}", JSON.toJSONString(request));
        List<UserOrderCpsStatisticResponse> data = userOrderCpsService.userOrderCpsStatistic(request);
        HttpResult<List<UserOrderCpsStatisticResponse>> result = HttpResult.success(data);
        log.info("用户个人(不包含下属)维度累计聚合，出参：{}", JSON.toJSONString(result));
        return result;
    }
}
